import request from '@/utils/request';

export async function getGoods(data = {}) {
  return request(`/admin/goods`, { data });
}

export async function addGoods(data = {}) {
  return request.post(`/admin/goods`, { data });
}

export async function switchOnBtn(id) {
  return request.patch(`/admin/goods/${id}/on`);
}
export async function switchRecommendBtn(id) {
  return request.patch(`/admin/goods/${id}/recommend`);
}

export async function getCascaderlist(data = {}) {
  return request(`/admin/category`, { data });
}

export async function updateGoods(data = {}) {
  return request.put(`/admin/goods/${data.id}`, { data });
}

export async function showGoods(id) {
  return request(`/admin/goods/${id}?include=category`);
}